<template>
  <div class="details">
    <div class="details-box">
    <h1 class="details-h1">
      <router-link to="/"> <i class="iconfont icon-24gl-arrowLeft2"></i></router-link>
      <span class="h1-name">{{name}}</span>
      <em class="iconfont icon-fenxiang_2"></em>
    </h1>
    
    <div class="details-content" >
      <van-loading class="loading" type="spinner" color="#1989fa" v-if="isShow"></van-loading>
    <h2 class="details-h2" v-bind:style="{backgroundColor:bgc}">
      <img :src="'../assets/img/'+url" />
      </h2>
    <h3 class="details-h3">
      <img src="@/assets/img/Bay.png" alt="" /><span>Baymax等248人卖过这本书</span>
      <i>></i>
    </h3>
    <h4 class="details-h4">
      <p>{{name}}</p>
      <p>
        <b>{{price}}元</b>
        <b>全新6.2折</b>
      </p>
      <p>
        <span>品&emsp;相&nbsp;：</span>
        <i>自营全新品++0.5</i>
      </p>
      <p>
        <span>原&emsp;价&nbsp;：</span>
        <i>￥45.00</i>
      </p>
      <p>
        <span>作&emsp;者&nbsp;：</span>
        <i>{{author}}</i>
      </p>
      <p>
        <span>出版社&nbsp;：</span>
        <i>华东师范大学出版社</i>
      </p>
      <p>
        <span>出&emsp;版&nbsp;：</span>
        <i>2016-09</i>
      </p>
      <p>
        <span>装&emsp;帧&nbsp;：</span>
        <i>平装</i>
      </p>
    </h4>
    
    <h5 class="details-h5">
      <span>豆瓣评分 8.3</span>
      <img src="@/assets/img/star.png" alt="" />
      <i>></i>
    </h5>
    <h5 class="details-h5 details-h52">
      <p class="p1">
        <b>自营</b>
        <b>正版·干净卫生·当天发货</b>
        <b>></b>
      </p>
    </h5>
    <h5 class="details-h5 details-h52">
      <p>
        <b>环保</b>
        <b>了解多抓鱼的环保探索</b>
        <b>></b>
      </p>
    </h5>
    <h6 class="details-h6">
      <p>简介和目录</p>
      <p>{{introduce}}</p>
      <p>查看更多</p>
    </h6>
    <div class="details-h7">
        <p>
            <span>鱼友评论</span>
            <span>☆ 给书评分</span>
        </p>
        <img src="@/assets/img/dian.png" alt="">
    </div>
    <div class="details-h8">
      <p>相关推荐</p>
      <p>
        <span>诗歌</span>
        <span>散文</span>
      </p>
      <ul>
        <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      <li>
          <img src="@/assets/img/zhongshiji.png" alt="">
          <div class="details-wenzi">中国“中世纪”的终结</div>
      </li>
      </ul>
    </div>
    <div class="details-h9">
<span></span><i>◆</i><span></span>
    </div>
    </div>
    <div class="details-10">
      <ul>
        <li>
          <router-link to="/Home">
            <i class="iconfont icon-shouye"></i>
          </router-link>
        </li>
        <li></li>
        <li>
          <router-link to="/Shoppingcart">
            <i class="iconfont icon-gouwuche"></i>
          </router-link>
          <b>0</b>
        </li>
        <li><router-link to="/shop" class="gouwuche">
          加入购物车
        </router-link></li>
      </ul>
    </div>
  </div>
  <van-loading class="loading" type="spinner" color="#1989fa" v-if="isShow"></van-loading>
  </div>
</template>
<script>
import axios from "axios";
export default {
  name:"Details",
  data() {
    return {
      img:"",
      url:"",
      author:"",
      name:"",
      price:"",
      introduce:"",
      bgc:""
    }
  },
  created(){
    axios({
      url:"http://localhost:3000/book/"+this.$route.params.id
    }).
    then(res=>{
      this.img=res.data.img;
      this.url=res.data.url;
      this.author=res.data.author;
      this.name=res.data.name;
      this.price=res.data.price;
      this.introduce=res.data.introduce;
      this.bgc=res.data.bgc;
    })
  }
}
</script>
<style scoped>
.gouwuche{
  color: #fff;
}
.h1-name{
  width: 2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.details-content{
  margin: .5rem 0 .78rem 0;
}
.details-10{
  width: 100%;
  height:.68rem ;
  position: fixed;
  bottom: 0;
  padding: 0 .1rem; 
  border-top: .01rem solid #999;
  background-color: #fff;
}
.details-10 ul{
  width: calc(100% - .2rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.details-10 ul li{
  height:.68rem ;
  line-height: .68rem;
}
.details-10 ul li .iconfont{
  font-size: 32px;
}
.details-10 ul li:nth-child(2){
  height: .5rem;
  border-right: .01rem solid #666;
}
.details-10 ul li:nth-child(3){
  position: relative;
}
.details-10 ul li b{
  font-size: 12px;
  text-align: center;
  line-height: .2rem;
  display: inline-block;
  width: .2rem;
  height: .2rem;
  border-radius: 50%;
  background-color: rgb(204, 85, 69);
  color: #fff;
  position: absolute;
  top: .1rem;
  right: -.1rem;
}
.details-10 ul li:nth-child(4){
  width: 1.9rem;
  height: .45rem;
  color: #fff;
  font-size: 20px;
  background-color: rgb(248, 93, 54);
  border-radius: .2rem;
  text-align: center;
  line-height: .45rem;
}
.details-h9{
  height: .6rem;
  line-height: .6rem;
  background-color: #fff;
  margin-right: .1rem;
  margin-left: .1rem;
  color: #999;
}
.details-h9 i{
float: left;
}
.details-h9 span{
  float: left;
  width: .5rem;
  height: .3rem;
  border-bottom: .01rem solid #999;
}
.details-h9 span:nth-child(1){
  margin-left: 1.2rem;
}
.details-h8{
  height: 6.8rem;
  margin: 0 .1rem;
}
.details-h8 p:nth-child(1){
  height: .6rem;
  line-height: .6rem;
  font-size: 24px;
  font-weight: 700;
}
.details-h8 p:nth-child(2){
  height: .4rem;
  line-height: .4rem;
  font-size: 14px;
  margin-bottom: .2rem;
}
.details-h8 p:nth-child(2) span{
  padding: .03rem .05rem;
  margin-right: .1rem;
  border: 1px solid #666;

}
.details-h8 ul{
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;

}
.details-h8 ul li{
  flex-shrink: 0;
  height: 1.7rem;
  width: .98rem;
  background-color: #fff;
  margin-bottom: .2rem;
}
.details-h8 ul li img{
  width: .98rem;
}
.details-h8 ul li .details-wenzi{
  font-size: 12px;
  height: .3rem;
  line-height: .3rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.details-h7{
  height: 1.4rem;
  line-height: .6rem;
  font-size: 24px;
  font-weight: 700;
  margin: .1rem;
}
.details-h7 p span:nth-child(1){
  font-size: 24px;
  font-weight: 700;
  float: left;
}
.details-h7 p span:nth-child(2){
  font-size: 14px;
  color: rgb(40, 102, 12);
  float: right;
}
.details-h7 img{
  width: 100%;
  height: .58rem;
  margin: .1rem 0;
}
.details-h6{
    height:3rem ;
    background-color: #fff;
    margin: .1rem;
}
.details-h6 p:nth-child(1){
    font-size: 24px;
    font-weight: 700;
    height: .5rem;
    line-height: .5rem;
}
.details-h6 p:nth-child(2){
height: 2rem;
overflow-y: auto;
}
.details-h6 p:nth-child(3){
    color: rgb(15, 78, 24);
height: .5rem;
width: 90%;
margin: 0 .1rem;
line-height: .5rem;
text-align: center;
font-size: 14px;
position: absolute;
}
.details-h5 {
  margin: 0 0.1rem 0.1rem 0.1rem;
  height: 0.5rem;
  background-color: #f1f1f1;
  display: flex;
  justify-content: space-around;
  align-items: center;
  color: rgb(240, 190, 81);
}
.details-h5 img {
  width: 0.8rem;
  height: 0.2rem;
}
.details-h5 span {
  flex: 1;
  padding-left: 0.1rem;
}
.details-h5 i {
  font-size: 28px;
  padding: 0 0.1rem;
}
.details-h52 {
  margin-bottom: 0;
}
.details-h52 p {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  height: 0.49rem;
  margin: 0 0.1rem;
}
.details-h52 .p1{
  border-bottom: .01rem solid #999;
}
.details-h52 b:nth-child(1) {
  color: #fff;
  padding: 0.05rem;
  background-color: rgb(10, 54, 10);
}
.details-h52 b:nth-child(2) {
  color: black;
  flex: 1;
  margin-left: .1rem;
}
.details-h52 b:nth-child(3) {
  color: #999;
  font-size: 28px;
}
@import url(../assets/iconfont/iconfont.css);
.details-box {
  height:auto;
  font-size: 30px;
  overflow-y: auto;
  background-color: #fff;
}
.details-h1 {
  width: 100%;
  height: 0.5rem;
  line-height: 0.5rem;
  background-color: #fff;
  position: fixed;
  top: 0;
}
.details-h1 i {
  float: left;
  padding:0 0.1rem;
  font-size: 30px;
}
.details-h1 span {
  font-size: 20px;
  font-weight: 700;
  float: left;
}
.details-h1 em{
  float: right;
  font-size: 28px;
  padding-right: 0.1rem;
}
.details-h2 {
  text-align: center;
  height: 2.6rem;
  /* background-color: rgb(145, 41, 15); */
}
.details-h2 img {
  width: 1.6rem;
  height: 1.95rem;
  padding-top: 0.3rem;
}
.details-h3 {
  height: 0.7rem;
  background-color: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-bottom: .01rem solid #999;
}
.details-h3 img {
  width: 0.8rem;
  height: 0.3rem;
}
.details-h3 span {
  font-size: 16px;
}
.details-h3 i {
  font-size: 28px;
  color: #666;
}
.details-h4 {
  height: 2.5rem;
  background-color: #fff;
  padding-left: 0.1rem;
}
.details-h4 p:nth-child(1) {
  font-size: 20px;
  font-weight: 700;
  padding-top: 0.1rem;
}
.details-h4 p:nth-child(2) {
  margin: 0.1rem 0.1rem 0.1rem 0;
}
.details-h4 p:nth-child(2) b:nth-child(1) {
  font-size: 20px;
  font-weight: 700;
}
.details-h4 p:nth-child(2) b:nth-child(2) {
  color: rgb(240, 190, 81);
  border: 1px solid rgb(240, 190, 81);
  padding: 0.05rem;
  margin-left: 0.1rem;
}
.details-h4 p {
  font-size: 14px;
  padding: 0.03rem 0;
}
.details-h4 p span {
  color: #999;
}
.details-h4 p:nth-child(3) i {
  color: rgb(240, 190, 81);
}
.details-h4 p:nth-child(5) i {
  color: rgb(34, 75, 34);
}
</style>